[mysqld]
datadir=<%= @datadir %>
bind-address=<%= @node_address %>
port=3307
max_connections=<%= @max_connections %>
default-storage-engine=innodb
binlog_format=ROW
log_bin=mysql-bin
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
default-storage-engine=innodb
expire_logs_days=10

skip-external-locking
<% if @skip_name_resolve -%>
skip-name-resolve
<% end -%>
<% if scope.lookupvar('memorysize_mb').to_i < 4000 -%>
performance_schema=off
<% end -%>

myisam_sort_buffer_size=<%= @myisam_sort_buffer_size %>
wait_timeout=<%= @wait_timeout %>
open_files_limit=<%= @open_files_limit %>
table_open_cache=<%= @table_open_cache %>
key_buffer_size=<%= @key_buffer_size %>
max_allowed_packet=256M
query_cache_size=0
query_cache_type=0

innodb_file_format=Barracuda
innodb_file_per_table=1
<% if @mysql_buffer_pool_size -%>
innodb_buffer_pool_size=<%= @mysql_buffer_pool_size %>
<% end -%>
<% if @innodb_log_file_size_real != '0' -%>
innodb_log_file_size=<%= @innodb_log_file_size_real %>
<% end -%>
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_io_capacity=500
innodb_flush_log_at_trx_commit=2
innodb_flush_method=<%= @innodb_flush_method %>
innodb_doublewrite=0
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1

<% if @setup_multiple_gcomm -%>
wsrep_cluster_address="gcomm://<%= @node_addresses.collect {|ip| ip + ':' + @gcomm_port.to_s }.join ',' %>?pc.wait_prim=no"
<% else -%>
wsrep_cluster_address="gcomm://<%= @node_addresses.first %>:<%= @gcomm_port.to_s %>?pc.wait_prim=no"
<% end -%>
wsrep_provider=<%= @libgalera_prefix %>/libgalera_smm.so
wsrep_cluster_name="<%= @cluster_name -%>"

wsrep_slave_threads=<%= [[@processorcount.to_i*2, 4].max, 12].min %>
wsrep_sst_method=<%= @wsrep_sst_method %>
<% if @wsrep_sst_auth -%>
wsrep_sst_auth=<%= @mysql_user %>:<%= @mysql_password %>
<% end -%>
wsrep_node_address=<%= @node_address %>
wsrep_provider_options="gcache.size = <%= [256, @gcache_factor.to_i*64, 2048].sort[1] %>M"

<% if @wsrep_sst_method =~ /xtrabackup/ -%>
[xtrabackup]
parallel=<%= [[@processorcount.to_i, 2].max, 6].min %>

[sst]
streamfmt=xbstream
transferfmt=socat
sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576
<% end -%>
